#include "Card.h"

unsigned char
card_get_value(Card card)
{
  if (card > 52)
    return 0;

  unsigned char value = (unsigned char) card;

  while (value > 13)
    value -= 13;

  // Return value
  return value;
}

unsigned char
card_get_suite(Card card)
{
  if (card < 14)
    return 1; // Hearts

  if (card < 27)
    return 2; // Diamonds

  if (card < 40)
    return 3; // Clubs

  if (card < 53)
    return 4; // Spades

  return 0;
}

unsigned char
card_get_score(Card card)
{
  unsigned char value = card_get_value(card);

  // Return value, but maximum of 10
  return (value > 10) ? 10 : value;
}
